package rmi.filesystem.server;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

import rmi.filesystem.common.IRemoteOutputStream;


public class RemoteOutputStreamImpl extends FileOutputStream implements IRemoteOutputStream {
		
	
	public RemoteOutputStreamImpl(File file) throws RemoteException, FileNotFoundException {
		
		super(file);
		UnicastRemoteObject.exportObject(this);
		
	}
	
	
	public void write(int b) throws RemoteException {
		// TODO Auto-generated method stub
		try{
			super.write(b);
		}catch(IOException e){
			throw new RemoteException("RemoteOutputStreamImpl", e);
		}
		
	}

	public void write(byte[] b, int off, int lenght) throws RemoteException {
		// TODO Auto-generated method stub
		try{
			super.write(b, off, lenght);
		}catch(IOException e){
			throw new RemoteException("RemoteOutputStreamImpl", e);
		}
	}

	public void close() throws IOException, RemoteException {
		// TODO Auto-generated method stub
		try{
			super.close();
		}catch(IOException e){
			throw new RemoteException("RemoteOutputStreamImpl", e);
		}
	}

}
